package com.manli.wechat.utils;

import com.manli.wechat.pojo.WeChatMiniProgramUserInfo;
import com.manli.wechat.pojo.WeChatUserInfo;
import lombok.Data;

/**
 * 小程序用户信息转换为微信
 */
@Data
public class WechatMiniUserInfoConvertToWechatUserInfo {

    public static WeChatUserInfo covert(WeChatMiniProgramUserInfo miniProgramUserInfo){
        WeChatUserInfo weChatUserInfo = new WeChatUserInfo();
        weChatUserInfo.setOpenid(miniProgramUserInfo.getOpenId());
        weChatUserInfo.setUnionid(miniProgramUserInfo.getUnionId());
        weChatUserInfo.setHeadimgurl(miniProgramUserInfo.getAvatarUrl());
        weChatUserInfo.setCity(miniProgramUserInfo.getCity());
        weChatUserInfo.setCountry(miniProgramUserInfo.getCountry());
        weChatUserInfo.setProvince(miniProgramUserInfo.getProvince());
        weChatUserInfo.setSex(miniProgramUserInfo.getGender());
        weChatUserInfo.setNickname(miniProgramUserInfo.getNickName());
        weChatUserInfo.setLanguage(miniProgramUserInfo.getLanguage());
        return  weChatUserInfo;
    }

}